package nav

/*
#include<stdint.h>
#include<stdbool.h>
extern void nav_rcChunkyTriMesh_Delete(void * c_this);
extern void nav_rcChunkyTriMesh_DeleteArray(void * c_this);
extern void * nav_rcChunkyTriMesh_GetPtrToMaxTrisPerChunk(void * c_this);
extern void * nav_rcChunkyTriMesh_GetPtrToNnodes(void * c_this);
extern void * nav_rcChunkyTriMesh_GetPtrToNodes(void * c_this);
extern void * nav_rcChunkyTriMesh_GetPtrToNtris(void * c_this);
extern void * nav_rcChunkyTriMesh_GetPtrToTris(void * c_this);
extern void * nav_rcChunkyTriMesh_IndexArray(void * c_this,long n);
extern void* nav_NewrcChunkyTriMesh();
extern void nav_rcChunkyTriMeshNode_Delete(void * c_this);
extern void nav_rcChunkyTriMeshNode_DeleteArray(void * c_this);
extern void * nav_rcChunkyTriMeshNode_GetPtrToBmax(void * c_this);
extern void * nav_rcChunkyTriMeshNode_GetPtrToBmin(void * c_this);
extern void * nav_rcChunkyTriMeshNode_GetPtrToI(void * c_this);
extern void * nav_rcChunkyTriMeshNode_GetPtrToN(void * c_this);
extern void * nav_rcChunkyTriMeshNode_IndexArray(void * c_this,long n);
extern void* nav_NewrcChunkyTriMeshNode();
extern void * nav_NewRcChunkyTriMeshNodePtrArray(long n);
extern void * nav_NewRcChunkyTriMeshPtrArray(long n);
extern bool nav_rcCreateChunkyTriMesh(void * verts,void * tris,int ntris,int trisPerChunk,void * cm);
extern int nav_rcGetChunksOverlappingRect(void * cm,void * bmin,void * bmax,void * ids,int maxIds);
extern int nav_rcGetChunksOverlappingSegment(void * cm,void * tmp_arg_p,void * q,void * ids,int maxIds);

*/
import "C"
import "unsafe"
import "gitee.com/hasika/cgo"

var _ unsafe.Pointer
var _ cgo.NotUsed

type RcChunkyTriMeshPtr uintptr

/*
public void Delete()
*/
func (p RcChunkyTriMeshPtr) Delete() {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	C.nav_rcChunkyTriMesh_Delete(wrap_this)
}

/*
void DeleteArray()
*/
func (p RcChunkyTriMeshPtr) DeleteArray() {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	C.nav_rcChunkyTriMesh_DeleteArray(wrap_this)
}

/*
public int * GetPtrToMaxTrisPerChunk()
*/
func (p RcChunkyTriMeshPtr) GetPtrToMaxTrisPerChunk() *int32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_rcChunkyTriMesh_GetPtrToMaxTrisPerChunk(wrap_this)
	go_out := (*int32)(unsafe.Pointer(wrap_out))
	return go_out
}

/*
public int * GetPtrToNnodes()
*/
func (p RcChunkyTriMeshPtr) GetPtrToNnodes() *int32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_rcChunkyTriMesh_GetPtrToNnodes(wrap_this)
	go_out := (*int32)(unsafe.Pointer(wrap_out))
	return go_out
}

/*
public rcChunkyTriMeshNode * * GetPtrToNodes()
*/
func (p RcChunkyTriMeshPtr) GetPtrToNodes() *RcChunkyTriMeshNodePtr {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_rcChunkyTriMesh_GetPtrToNodes(wrap_this)
	go_out := (*RcChunkyTriMeshNodePtr)(unsafe.Pointer(wrap_out))
	return go_out
}

/*
public int * GetPtrToNtris()
*/
func (p RcChunkyTriMeshPtr) GetPtrToNtris() *int32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_rcChunkyTriMesh_GetPtrToNtris(wrap_this)
	go_out := (*int32)(unsafe.Pointer(wrap_out))
	return go_out
}

/*
public int * * GetPtrToTris()
*/
func (p RcChunkyTriMeshPtr) GetPtrToTris() **int32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_rcChunkyTriMesh_GetPtrToTris(wrap_this)
	go_out := (**int32)(unsafe.Pointer(wrap_out))
	return go_out
}

/*
rcChunkyTriMesh * IndexArray(long n)
*/
func (p RcChunkyTriMeshPtr) IndexArray(n int) uintptr {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_rcChunkyTriMesh_IndexArray(wrap_this, C.long(n))
	go_out := uintptr(wrap_out)
	return go_out
}

/*
public rcChunkyTriMesh()
*/
func NewRcChunkyTriMesh() cgo.GoManagedPtr[RcChunkyTriMeshPtr] {
	wrap_out := C.nav_NewrcChunkyTriMesh()
	go_out := cgo.MakePtr[cgo.GoManagedPtr[RcChunkyTriMeshPtr]](uintptr(wrap_out))
	return go_out
}

type RcChunkyTriMeshNodePtr uintptr

/*
public void Delete()
*/
func (p RcChunkyTriMeshNodePtr) Delete() {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	C.nav_rcChunkyTriMeshNode_Delete(wrap_this)
}

/*
void DeleteArray()
*/
func (p RcChunkyTriMeshNodePtr) DeleteArray() {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	C.nav_rcChunkyTriMeshNode_DeleteArray(wrap_this)
}

/*
public float(*)[2] GetPtrToBmax()
*/
func (p RcChunkyTriMeshNodePtr) GetPtrToBmax() *[2]float32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_rcChunkyTriMeshNode_GetPtrToBmax(wrap_this)
	go_out := (*[2]float32)(unsafe.Pointer(wrap_out))
	return go_out
}

/*
public float(*)[2] GetPtrToBmin()
*/
func (p RcChunkyTriMeshNodePtr) GetPtrToBmin() *[2]float32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_rcChunkyTriMeshNode_GetPtrToBmin(wrap_this)
	go_out := (*[2]float32)(unsafe.Pointer(wrap_out))
	return go_out
}

/*
public int * GetPtrToI()
*/
func (p RcChunkyTriMeshNodePtr) GetPtrToI() *int32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_rcChunkyTriMeshNode_GetPtrToI(wrap_this)
	go_out := (*int32)(unsafe.Pointer(wrap_out))
	return go_out
}

/*
public int * GetPtrToN()
*/
func (p RcChunkyTriMeshNodePtr) GetPtrToN() *int32 {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_rcChunkyTriMeshNode_GetPtrToN(wrap_this)
	go_out := (*int32)(unsafe.Pointer(wrap_out))
	return go_out
}

/*
rcChunkyTriMeshNode * IndexArray(long n)
*/
func (p RcChunkyTriMeshNodePtr) IndexArray(n int) uintptr {
	var wrap_this unsafe.Pointer
	wrap_this = unsafe.Pointer(p)
	wrap_out := C.nav_rcChunkyTriMeshNode_IndexArray(wrap_this, C.long(n))
	go_out := uintptr(wrap_out)
	return go_out
}

/*
public rcChunkyTriMeshNode()
*/
func NewRcChunkyTriMeshNode() cgo.GoManagedPtr[RcChunkyTriMeshNodePtr] {
	wrap_out := C.nav_NewrcChunkyTriMeshNode()
	go_out := cgo.MakePtr[cgo.GoManagedPtr[RcChunkyTriMeshNodePtr]](uintptr(wrap_out))
	return go_out
}

/*
rcChunkyTriMeshNode * NewRcChunkyTriMeshNodePtrArray(long n)
*/
func NewRcChunkyTriMeshNodePtrArray(n int) cgo.GoManagedPtr[cgo.Array[RcChunkyTriMeshNodePtr]] {
	wrap_out := C.nav_NewRcChunkyTriMeshNodePtrArray(C.long(n))
	go_out := cgo.MakePtr[cgo.GoManagedPtr[cgo.Array[RcChunkyTriMeshNodePtr]]](uintptr(wrap_out))
	return go_out
}

/*
rcChunkyTriMesh * NewRcChunkyTriMeshPtrArray(long n)
*/
func NewRcChunkyTriMeshPtrArray(n int) cgo.GoManagedPtr[cgo.Array[RcChunkyTriMeshPtr]] {
	wrap_out := C.nav_NewRcChunkyTriMeshPtrArray(C.long(n))
	go_out := cgo.MakePtr[cgo.GoManagedPtr[cgo.Array[RcChunkyTriMeshPtr]]](uintptr(wrap_out))
	return go_out
}

/*
Creates partitioned triangle mesh (AABB tree),
where each node contains at max trisPerChunk triangles.

bool rcCreateChunkyTriMesh(float const * verts, int const * tris, int ntris, int trisPerChunk, rcChunkyTriMesh * cm)
*/
func RcCreateChunkyTriMesh(verts *float32, tris *int32, ntris int32, trisPerChunk int32, cm RcChunkyTriMeshPtr) bool {
	var wrap_arg_verts unsafe.Pointer
	var wrap_arg_tris unsafe.Pointer
	var wrap_arg_ntris C.int
	var wrap_arg_trisPerChunk C.int
	var wrap_arg_cm unsafe.Pointer
	wrap_arg_verts = (unsafe.Pointer)(verts)
	wrap_arg_tris = (unsafe.Pointer)(tris)
	wrap_arg_ntris = (C.int)(ntris)
	wrap_arg_trisPerChunk = (C.int)(trisPerChunk)
	wrap_arg_cm = (unsafe.Pointer)(cm)
	wrap_out := C.nav_rcCreateChunkyTriMesh(wrap_arg_verts, wrap_arg_tris, wrap_arg_ntris, wrap_arg_trisPerChunk, wrap_arg_cm)
	go_out := bool(wrap_out)
	return go_out
}

/*
Returns the chunk indices which overlap the input rectable.

int rcGetChunksOverlappingRect(rcChunkyTriMesh const * cm, float(bmin)[2], float(bmax)[2], int * ids, int const maxIds)
*/
func RcGetChunksOverlappingRect(cm RcChunkyTriMeshPtr, bmin *[2]float32, bmax *[2]float32, ids *int32, maxIds int32) int32 {
	var wrap_arg_cm unsafe.Pointer
	var wrap_arg_bmin unsafe.Pointer
	var wrap_arg_bmax unsafe.Pointer
	var wrap_arg_ids unsafe.Pointer
	var wrap_arg_maxIds C.int
	wrap_arg_cm = (unsafe.Pointer)(cm)
	wrap_arg_bmin = (unsafe.Pointer)(bmin)
	wrap_arg_bmax = (unsafe.Pointer)(bmax)
	wrap_arg_ids = (unsafe.Pointer)(ids)
	wrap_arg_maxIds = (C.int)(maxIds)
	wrap_out := C.nav_rcGetChunksOverlappingRect(wrap_arg_cm, wrap_arg_bmin, wrap_arg_bmax, wrap_arg_ids, wrap_arg_maxIds)
	go_out := int32(wrap_out)
	return go_out
}

/*
Returns the chunk indices which overlap the input segment.

int rcGetChunksOverlappingSegment(rcChunkyTriMesh const * cm, float(tmp_arg_p)[2], float(q)[2], int * ids, int const maxIds)
*/
func RcGetChunksOverlappingSegment(cm RcChunkyTriMeshPtr, tmp_arg_p *[2]float32, q *[2]float32, ids *int32, maxIds int32) int32 {
	var wrap_arg_cm unsafe.Pointer
	var wrap_arg_tmp_arg_p unsafe.Pointer
	var wrap_arg_q unsafe.Pointer
	var wrap_arg_ids unsafe.Pointer
	var wrap_arg_maxIds C.int
	wrap_arg_cm = (unsafe.Pointer)(cm)
	wrap_arg_tmp_arg_p = (unsafe.Pointer)(tmp_arg_p)
	wrap_arg_q = (unsafe.Pointer)(q)
	wrap_arg_ids = (unsafe.Pointer)(ids)
	wrap_arg_maxIds = (C.int)(maxIds)
	wrap_out := C.nav_rcGetChunksOverlappingSegment(wrap_arg_cm, wrap_arg_tmp_arg_p, wrap_arg_q, wrap_arg_ids, wrap_arg_maxIds)
	go_out := int32(wrap_out)
	return go_out
}
